import request from '@/utils/request'

// 获取所有教练列表
export function getCoachList() {
  return request({
    url: '/api/coach/list',
    method: 'get'
  })
}

// 获取单个教练信息
export function getCoachById(id) {
  return request({
    url: `/api/coach/${id}`,
    method: 'get'
  })
}

// 添加教练
export function addCoach(data) {
  return request({
    url: '/api/coach',
    method: 'post',
    data
  })
}

// 更新教练信息
export function updateCoach(id, data) {
  return request({
    url: `/api/coach/${id}`,
    method: 'put',
    data
  })
}

// 删除教练
export function deleteCoach(id) {
  return request({
    url: `/api/coach/${id}`,
    method: 'delete'
  })
}

// 根据教练ID获取学员列表
export function getStudentsByCoachId(coachId) {
  return request({
    url: `/api/coach/${coachId}/students`,
    method: 'get'
  })
}
